package by.grsu.hdm.model;

public abstract class HomeDevice implements IHomeDevice {

	private String id;
	
	protected HomeDevice() {
	}
	
	public HomeDevice(String id) {
		this.id = id;
	}

	@Override
	public HomeDeviceStatus turnOn() {
		this.afterTurningOn();
		return new HomeDeviceStatus(1, "The device " + getDeviceId() + " is turned on");
	}

	@Override
	public HomeDeviceStatus turnOff() {
		this.beforeTurningOff();
		return new HomeDeviceStatus(2, "The device " + getDeviceId() + " is turned off");
	}
	
	protected void afterTurningOn() { }
	
	protected void beforeTurningOff() { }
	
	public String getDeviceId() {
		return this.id;
	}
	
	protected void defaultConfiguration() { }
}
